<!--相关订单-->
<template>
 <div>
   <el-table :data="orderList" v-loading="loading" border size="mini" stripe fit border :header-cell-style="{'text-align':'center'}">
     <el-table-column label="订单状态" align="center" prop="status" :formatter="statusFormat" />
     <el-table-column label="订单号" align="center" prop="shippingNoteNumber" show-overflow-tooltip />
     <el-table-column label="运费金额(元)" align="center" prop="totalMonetaryAmount" />
     <el-table-column label="物流公司" align="center" prop="companyName" show-overflow-tooltip v-if="userType !== $store.state.constants.userType_company"/>
     <el-table-column label="托运人" align="center" prop="consignor" show-overflow-tooltip />
     <el-table-column label="装货地址" align="center" prop="placeOfLoading" show-overflow-tooltip />
     <el-table-column label="收货方" align="center" prop="consignee" show-overflow-tooltip />
     <el-table-column label="收货地址" align="center" prop="goodsReceiptPlace" show-overflow-tooltip />
     <el-table-column label="司机" align="center" prop="driverName" width="80"/>
     <el-table-column label="司机电话" align="center" prop="driverPhone" />
     <el-table-column label="上传" align="center" prop="isSendToPro" width="80" :formatter="isSendToProFormat" />
   </el-table>
 </div>
</template>
<script>
  import { comOrder } from '@/api/tws/order'
  export default {
    name:'OrderList',
    components:{

    },
    data(){
      return{
        // 是否已上传
        isSendToProOptions: [{
          dictValue: '0',
          dictLabel: '未上传'
        }, {
          dictValue: '1',
          dictLabel: '已上传'
        }],
        // 订单状态字典数据
        statusOptions: [],
        orderList:[],
        loading:true,
      }
    },
    watch:{
      orderType: function (newData,oldData) {
        if (newData) {
          this.orderType = newData
        }
      },
      getOrderId: function (newData,oldData) {
        if (newData) {
          this.getOrderId = newData;
        }
      },
    },
    created(){
      this.userType = this.$store.state.user.type;
     this.getDict();
    },
    methods:{
      getDict() {
        // 订单状态字典
        this.getDicts("order_status").then(response => {
          this.statusOptions = response.data;
        });
      },
      //获取相关订单列表
      getList(id,type){
        comOrder(id,type).then(res =>{
          this.orderList = res.data;
          this.loading = false;
        })
      },
      // 是否已上传翻译
      isSendToProFormat(row, column) {
        return this.selectDictLabel(this.isSendToProOptions, row.isSendToPro);
      },
      // 订单状态字典翻译
      statusFormat(row, column) {
        return this.selectDictLabel(this.statusOptions, row.status);
      },
    }
  }
</script>
<style>

</style>
